package online.shenme.itcast.service;


import online.shenme.itcast.entity.ExamInfo;
import online.shenme.itcast.entity.QuestionInfo;
import online.shenme.itcast.entity.User;

import java.io.IOException;
import java.util.List;


/**
 * 考试软件的核心业务模型
 */
public interface ExamService {
    /**
     * 登录功能
     *
     * @param id  用户编号
     * @param pwd 用户密码
     * @return 登录成功的用户对象
     */
    User login(String id, String pwd) throws IOException;


    /*
        1.ExamService定义抽象方法 返回ExamInfo
        2.ExamService定义抽象方法 返回QuestionInfo
        3.在ExamServiceImpl中实现
     */

    ExamInfo getExamInfo(User user);
    QuestionInfo getQustionInfo(int index) throws IOException;
    void setQustionInfo(List<Integer> answer, int index) throws IOException;


    QuestionInfo next(int currentQuestion) throws IOException;

    QuestionInfo prev(int currentQuestion) throws IOException;

    int userScore(ExamInfo examInfo) throws IOException;

    long updateTime(ExamInfo examInfo);

    void isExam(User user) throws IOException;

    int queryScore(User user) throws IOException;
}
